﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CKFinder;

public partial class Admin_SendMail : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ckeditor_sendmail.config.toolbar = "Basic";
        CKFinder.FileBrowser fb = new FileBrowser();
        fb.BasePath = "../ckfinder/";
        fb.SetupCKEditor(ckeditor_sendmail);
    }
    protected void btnSendMail_Click(object sender, EventArgs e)
    {
        string listemail = txtEmail.Text;
        string subject = txtTitle.Text;
        string content = ckeditor_sendmail.Text;
        char[] s = {','};
        string[] arrEmail = listemail.Split(s);
        SendMail sm = new SendMail();
        sm.DisplayName = "Hoàng Hà Mobile";
        sm.Content = content;
        sm.Templatefile = Server.MapPath("~/Admin/Contact.htm");
        sm.Subject = subject;
        sm.Sender = "Thangepc";
        foreach (var item in arrEmail)
        {
            sm.To = item.ToString();
            if(!sm.SendEMail())
            {
                continue;
            }
        }
    }
}